unit Unit3;

interface

uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
  Buttons, ExtCtrls;

type
  TFindSomeWord = class(TForm)
    OKButton: TButton;
    Edit1: TEdit;
    Label1: TLabel;
    procedure OKButtonClick(Sender: TObject);
  private
{HighLight Find Text... This Code Doesent Work Well.}
    Procedure searchandhighlighttext(atext:string);
{... }    
  public
    { Public declarations }
  end;

var
  FindSomeWord: TFindSomeWord;

implementation

uses Unit1;

{$R *.dfm}

procedure TFindSomeWord.OKButtonClick(Sender: TObject);
begin
  searchandhighlighttext(findsomeword.Edit1.Text);
end;

{HighLight Find Text... This Code Doesent Work Well.}
procedure tfindsomeword.searchandhighlighttext(atext:string);
  var
  i:integer;
  begin
  for i:=0 to mainform.webbrowser.OleObject.document.all.length-1 do
  begin
  if pos(atext,mainform.webbrowser.OleObject.document.all.item(i).innertext)<>0 then
  begin
  mainform.webbrowser.OleObject.document.all.item(I).style.color:=clblue;
  mainform.webbrowser.OleObject.document.all.item(I).scrollintoview(true);
  end;
  end;
  end;
{.....}

end.

